package com.design.observer;

import java.util.Date;

public class PrototypePattern implements Cloneable{
	private String s;
	private Integer i;
	private int in;
	private final Date date = new Date();
	
	public static void main(String[] args) throws Exception {
		PrototypePattern p = new PrototypePattern();
		p.s = "cba";
		p.i = 11;
		p.in = 22;
		PrototypePattern clone = (PrototypePattern) p.clone();
		
		System.out.println(p);
		System.out.println(clone);
		p.s = "abc";
		p.i = 111;
		p.in = 222;
		p.date.setTime(111111111111L);
		System.out.println(p);
		System.out.println(clone);
	}

	@Override
	public String toString() {
		return "PrototypePattern [s=" + s + ", i=" + i + ", in=" + in + ", date=" + date + "]";
	}
	
}
